#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn=200000;

class Ele {
public:
  int k, v;

  static bool cmp(Ele a, Ele b) {
    return a.k<b.k;
  }
};

class Tree {
public:
  int son[maxn+1], fa[maxn+1], bro[maxn+1], f[maxn+1], g[maxn+1], ans[maxn+1];

  void addSide(int f, int s) {
    fa[s] = f, bro[s] = son[f], son[f] = s;
  }

  void calcF(int o) {
#ifdef DEBUG
    static bool book[maxn+1];
    if (book[o]) {
      printf("ERR\n");
      return;
    } else {
      book[o] = true;
    }
#endif
    static int sont[maxn+1];
    int sons=0;
    for (int i=son[o]; i; i=bro[i]) {
      calcF(i);
    }
    for (int i=son[o]; i; i=bro[i]) {
      sont[++sons] = f[i];
    }
    sort(sont+1, sont+sons+1);
    for (int i=1; i<=sons; i++) {
      f[o] = max(f[o], sont[i]+sons-i+1);
    }
  }

  void calcG(int o) {
    static Ele sont[maxn+1];
    int sons=1;
    sont[1].k = g[o];
    sont[1].v = 0;
    for (int i=son[o]; i; i=bro[i]) {
      if (i!=o) {
	sont[++sons].k = f[i];
	sont[sons].v = i;
      }
    }
    sort(sont+1, sont+sons+1, Ele::cmp);
    int fp=1;
    for (int i=1; i<=sons; i++) {
      if (sont[fp].k+sons-fp+1<=sont[i].k+sons-i+1) {
	fp = i;
      }
    }
    if (sont[fp].v) {
      for (int i=1; i<=sons; i++) {
	if (i<fp) {
	  g[sont[fp].v] = max(g[sont[fp].v], sont[i].k+sons-i);
	} else if (i>fp) {
	  g[sont[fp].v] = max(g[sont[fp].v], sont[i].k+sons-i+1);
	}
      }
    }
    for (int i=1; i<=sons; i++) {
      if (sont[i].v && i!=fp) {
	g[sont[i].v] = sont[fp].k+sons-fp+(i<fp);
      }
    }
    for (int i=son[o]; i; i=bro[i]) {
      calcG(i);
    }
  }

  void solve(int o) {
    static int sont[maxn+1];
    int sons=1;
    sont[1] = g[o];
    for (int i=son[o]; i; i=bro[i]) {
      sont[++sons] = f[i];
    }
    sort(sont+1, sont+sons+1);
    for (int i=1; i<=sons; i++) {
      ans[o] = max(ans[o], sont[i]+sons-i+1);
    }
    for (int i=son[o]; i; i=bro[i]) {
      solve(i);
    }
  }
};

int main() {
  freopen("news.in", "r", stdin);
  freopen("news.out", "w", stdout);

  static Tree tree;
  int n;
  scanf("%d", &n);
  for (int i=2; i<=n; i++) {
    int t;
    scanf("%d", &t);
    tree.addSide(t, i);
  }

  tree.g[1] = -1;
  tree.calcF(1), tree.calcG(1), tree.solve(1);

  int ans[maxn+1], ansv=n*2;
  for (int i=1; i<=n; i++) {
    if (ansv>tree.ans[i]) {
      ansv = tree.ans[i];
      ans[0] = 0;
    }
    if (ansv==tree.ans[i]) {
      ans[++ans[0]] = i;
    }
  }

  printf("%d\n", ansv+1);
  for (int i=1; i<=ans[0]; i++) {
    printf("%d ", ans[i]);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
